import useLatest from "./useLatest.ts";
import {useEffect} from "react";

export default function useUnmount(fn: () => void) {
    const fnRef = useLatest(fn)
    useEffect(() => () => {
        fnRef.current()
    }, []);
}
